1. Technical Field
The present invention relates to a method and system for monitoring the execution of hybrid source code, and more particularly to an execution monitor for code containing Java and HTML source code.
2. Prior Art
The ubiquitous Internet, is essentially a network of computers connected using the TCP/IP as the transportation mechanism for communicating between the computers. The World Wide Web (WWW) allows users on one computer to access files and data on remote computers using a program called a Web browser. One feature of a browser is that it allows a user to read, in a graphical user interfave (GUI), Hyper Text Markup Language (HTML) documents or, colloquially, Web pages. Essentially, when the person accessing the Internet (the user) opens a browser or another similar program to view Web pages a URL (uniform resource locator) must be specified by the user, by the browser or by another software program. The URL specifies the address of the computer (server) from which the Web page is being requested. The server then, directly or indirectly, delivers the requested Web pages in the form of an HTML file to the browser over the Internet, generally using the Hypertext Transfer Protocol (HTTP). The browser then translates the file for viewing by the user.
As the use of the Internet progressed it became clear that simply providing people with static pages that contained only text and images was not going to be enough. For example, businesses that were going xe2x80x9con-linexe2x80x9d needed more powerful tools that could allow the user to access their databases and to purchase goods over the Internet.
Unfortunately, not everyone uses the same computers or even the same operating systems, so a need arose for a programming language that could operate on any machine regardless of its operating system. One of the languages that has accomplished this is Sun Microsystems, Inc.""s Java(trademark) language, an object-oriented, network capable programming language. Java code is run on a virtual machine within an operating system. The communication between the virtual machine and the Java program is the same for all operating systems, and the virtual machine communicates to the operating system it is running on. Java programs can run as stand alone applications or as applets running under a Java capable browser. To create an applet, the developer writes it in the Java language, compiles it and calls it from a HTML Web page. To create an application, the developer writes it in the Java language, compiles it and calls it from the command line or from another program.
Currently, the most visible examples of Java software are xe2x80x9cappletsxe2x80x9d that are available on the Internet. These applets are sent from the server to the browser, which acts as the virtual machine to execute the applet However, there are other kinds of Java software, including software that runs on servers, or on large mainframe computers. In these cases, Java may be used to monitor transactions, manipulate data, or to streamline the flow of information between departments, suppliers, and customers.
Further developments in this area have led to JavaServer(trademark)Pages(trademark)(JSP) technology, which is a new hybrid language. JSP technology allows Java code to be imbedded directly into a static HTML Web document. This feature makes it possible to create dynamically generated content for Web pages quickly and easily on the server. Also, the imbedded Java code is designed to act more as a scripting language than Java programming, although it may act as both, emphasizing the use of components conforming to Sun Microsystems, Inc.""s JavaBeans(trademark) specification.
JavaBeans is a portable, platform-independent component model written in the Java programming language. JavaBeans acts as a bridge between proprietary component models. Since these components do much of the processing work, component development is more cleanly separated from Web design (formatting). Therefore, teams developing the component (business rules) aspect of the Web page do not have to be a concerned with the appearance of the page, and vice versa.
Another advantage of the JSP technology is that it is compiled and executed on the server side. An important result of this is the fact that the browser doesn""t need to have any special capabilities to view a JSP file or page since it is completely processed on the server side and delivered to the browser in HTML format. Another result is that the JSP file is only compiled once. The server checks to see if the JSP file has been altered since it was last compiled. If it has then it is recompiled, but if it hasn""t then it can be run from memory reducing the average access time of the page.
From a developer""s point of view, there are however still some deficiencies with the JSP development environment. Currently, the only method a developer has of verifying the JSP code that has been written is to load the page onto a Web server, load it through a Web browser and inspect the output. This method, however, is far from satisfactory, as the developer has to guess where an error in the JSP page is originating. Further, it is a very tedious process that can lead to unwanted errors.
In accordance with an aspect of the invention, there is provided a method for monitoring the execution of hybrid source code which is executable on a server, comprising the steps of: generating executable code for execution by the server from the hybrid source code; providing instrumentation in the executable code for supporting execution tracing; and receiving in an execution monitor information from the instrumentation in the executable code for display on a user interface.
The step of generating executable code may further comprise translating the hybrid source code into source code. The step of providing instrumentation may also comprise inserting instrumentation into the source code.
The instrumentation may comprise a mapping table comprising information correlating a code segment in the hybrid source code with a line in the source code. The instrumentation may further comprise a line method for communicating said correlating information to the execution monitor. The method may also comprise displaying on the user interface the hybrid source code and the source code. The method may further comprise correlating a code segment from the hybrid source code with one or more lines of code from the source code using the instrumentation. The hybrid source code may be JavaServer Pages code.
There is also provided a method for monitoring execution of hybrid source code which executes in a server, comprising the steps of translating the hybrid source code by a page compiler into a source code form and an executable code; providing methods into the executable code, such that when the server executes the executable code, the methods are invoked and send line information to an execution monitor allowing the execution monitor to synchronize an executing code segment of the hybrid source code with a corresponding line of the source code; and displaying the executing code segment of the hybrid source and the corresponding line of the source code in a user interface.
In accordance with another aspect of the invention, there is provided a program storage device readable by a data processing system, tangibly embodying a program of instructions, executable by the data processing system to perform the above method steps.
In accordance with another aspect of the invention, a computer program product for monitoring the execution of hybrid source code which is executable on a server, said computer program product comprising a page compiler for reading and translating the hybrid source code into executable code for execution by the server and for inserting instrumentation in the executable code for supporting execution tracing; and an execution monitor for receiving information from the instrumentation in the executable code for display on a user interface.
There is also provided a computer program product for displaying the execution of hybrid source code, comprising a page compiler for translating the hybrid source code into source code, inserting instrumentation for execution tracing in the source code and compiling the hybrid source code into executable code; an execution monitor for receiving as input and for displaying in a user interface of the execution monitor, the hybrid source, the source code, and information from the instrumentation in the executable code. The computer program product may filer comprise a server for executing the executable code provided by the page compiler, and providing the information from the instrumentation in the executable code to the execution monitor. The computer program product may further comprise a browser for sending a request with respect to the hybrid source code, wherein the server further invokes the page compiler in response to the request and provides the output from the executable code to the browser. The execution monitor may further receive output from the executable code and wherein the server provides the output from the executable code to the execution monitor. The computer program product may further comprise a bi-directional communications means for communicating between the executing code and the execution monitor including communicating the information from the instrumentation in the executable code to the execution monitor. And the hybrid source code may be JavaServer Pages code.
In accordance with another aspect of the invention, there is provided a computer system monitoring the execution of hybrid source code which is executable on a server, said computer system comprising a page compiler for reading and translating the hybrid code into executable code for execution by the server and for inserting instrumentation in the executable code for supporting execution tracing; and an execution monitor for receiving information from the instrumentation in the executable code for display on a user interface.
In accordance with another aspect of the invention, there is provided a computer system for displaying the execution of hybrid source code, comprising a page compiler for translating the hybrid source code into source code, inserting instrumentation for execution tracing in the source code and compiling the hybrid source code into executable code; and an execution monitor for receiving as input and for displaying in a user interface of the execution monitor, the hybrid source, the source code, and information from the instrumentation in the executable code. The computer may further comprise a server for executing the executable code provided by the page compiler, and providing the information from the instrumentation in the executable code to the execution monitor. The computer system may further comprise a browser for sending a request with respect to the hybrid source code, wherein the server further invokes the page compiler in response to the request and provides the output from the executable code to the browser. Further, the execution monitor may further receive output from the executable code and wherein the server provides the output from the executable code to the execution monitor. The computer system may further comprise a bi-directional communication means for communicating information between the executing code and the execution monitor including information from the instrumentation to correlate a code segment of the hybrid source code and a line in the source code.
In accordance with another aspect of the invention, there is provided an article of manufacture comprising a computer usable medium having a computer readable program code embodied therein for monitoring the execution of hybrid source code, comprising HTML and Java code, running on a Web application server, the computer readable program code in said article of manufacture comprising computer readable program code configured to cause a computer to read and translate the hybrid source code into an executable program and for inserting instrumentation in the executable program; computer readable program code configured to cause a computer to read the hybrid source code, a source code of the executable program and an output from the executable program and for displaying the hybrid source code, source code and the output in respective views on a graphical user interface; and computer readable program code configured to cause a computer to communicate information between the instrumentation of the executing program and the graphical user interface whereby the information is used by the graphical user interface to correlate in the views a code segment of the hybrid source code with a line in the source code of the executable code.